package aod.android.com.bernay.message.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.MultiItemTypeAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.ArrayList;
import java.util.List;

import aod.android.com.bernay.R;
import aod.android.com.bernay.base.BernayBaseActivity;
import aod.android.com.bernay.message.module.DeviceMsgBean;
import chen.lion.hilib.view.bind.HiView;

/**
 * @author crated by zhixianuanyang on 2019/4/8 11:20
 * @Email jamesKing0812@gmail.com
 */
public class DeviceMsgActivity extends BernayBaseActivity {

    @HiView(R.id.device_recycleView)
    RecyclerView mDeviceRecycleView;

    private Bundle bundle;

    private List<DeviceMsgBean> mDeviceData = new ArrayList<>();

    private CommonAdapter<DeviceMsgBean> mAdapter;

    @Override
    protected int initLayout() {
        return R.layout.activity_device_msg;
    }

    @Override
    protected void initData() {
        bundle = getIntent().getExtras();
        String title = bundle.getString("deviceMsg");
        initTitle(title,R.drawable.icon_delete,new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showToast("清空列表");
            }
        });
        initListData();

    }

    private void initListData() {
        mDeviceData = new DeviceMsgBean().setData();
        mDeviceRecycleView.setLayoutManager(new LinearLayoutManager(this));
        mAdapter = new CommonAdapter<DeviceMsgBean>(DeviceMsgActivity.this,R.layout.device_message_list,mDeviceData) {
            @Override
            protected void convert(ViewHolder holder, DeviceMsgBean deviceMsgBean, int position) {

            }
        };
        mAdapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {

            }

            @Override
            public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
                return false;
            }
        });
        mDeviceRecycleView.setAdapter(mAdapter);
    }
}
